using Terra.Core.Common.ErrorCodes.Attributes;
using Terra.Core.Common.ErrorCodes.Models;

namespace Terra.Core.Common.ErrorCodes.Constants;

/// <summary>
/// 业务错误码
/// </summary>
public static class BusinessErrorCodes
{
    /// <summary>
    /// 通用业务错误
    /// </summary>
    [ErrorCode("BUS001", "业务处理失败: {0}", Severity = ErrorSeverity.Error)]
    public const string BusinessError = "BUS001";

    /// <summary>
    /// 操作不允许
    /// </summary>
    [ErrorCode("BUS002", "当前状态不允许此操作", Severity = ErrorSeverity.Error)]
    public const string OperationNotAllowed = "BUS002";

    /// <summary>
    /// 资源不足
    /// </summary>
    [ErrorCode("BUS003", "资源不足: {0}", Severity = ErrorSeverity.Error)]
    public const string InsufficientResources = "BUS003";

    /// <summary>
    /// 配额超限
    /// </summary>
    [ErrorCode("BUS004", "{0} 已达到上限 {1}", Severity = ErrorSeverity.Error)]
    public const string QuotaExceeded = "BUS004";

    /// <summary>
    /// 依赖服务异常
    /// </summary>
    [ErrorCode("BUS005", "依赖服务异常: {0}", Severity = ErrorSeverity.Error)]
    public const string DependencyError = "BUS005";

    /// <summary>
    /// 操作已过期
    /// </summary>
    [ErrorCode("BUS006", "操作已过期", Severity = ErrorSeverity.Error)]
    public const string OperationExpired = "BUS006";

    /// <summary>
    /// 重复操作
    /// </summary>
    [ErrorCode("BUS007", "请勿重复操作", Severity = ErrorSeverity.Error)]
    public const string DuplicateOperation = "BUS007";

    /// <summary>
    /// 操作取消
    /// </summary>
    [ErrorCode("BUS008", "操作已取消", Severity = ErrorSeverity.Info)]
    public const string OperationCancelled = "BUS008";

    /// <summary>
    /// 操作中断
    /// </summary>
    [ErrorCode("BUS009", "操作已中断: {0}", Severity = ErrorSeverity.Warning)]
    public const string OperationInterrupted = "BUS009";

    /// <summary>
    /// 任务执行失败
    /// </summary>
    [ErrorCode("BUS010", "任务执行失败: {0}", Severity = ErrorSeverity.Error)]
    public const string TaskExecutionFailed = "BUS010";

    /// <summary>
    /// 配置错误
    /// </summary>
    [ErrorCode("BUS011", "配置错误: {0}", Severity = ErrorSeverity.Error)]
    public const string ConfigurationError = "BUS011";

    /// <summary>
    /// 初始化失败
    /// </summary>
    [ErrorCode("BUS012", "初始化失败: {0}", Severity = ErrorSeverity.Critical)]
    public const string InitializationFailed = "BUS012";
}